package person.bing.fbcloud.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: mengfanbing
 * @date: 2020/9/14 9:15
 */
public class Q94 {
    public static void main(String[] args) {

    }


    public static List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> ans = new ArrayList<>();
        if (root != null){
            util(ans,root);
        }
        return ans;
    }
    public static void util(List<Integer> ans,TreeNode root) {
        if (root != null){
            util(ans,root.left);
            ans.add(root.val);
            util(ans,root.right);
        }else{
            return;
        }

    }
    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode(int x) { val = x; }
    }
}
